package com.lanxiao.cloud.gateway.handler;

import com.lanxiao.cloud.gateway.application.RouteDefinitionManager;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

/**
 * @author ：qiaoliang
 * @date ：2021-08-23
 */
@Component
public class GatewayRouteHandler implements CommandLineRunner {

  private final RouteDefinitionManager routeDefinitionRepository;

  public GatewayRouteHandler(
      RouteDefinitionManager routeDefinitionRepository) {
    this.routeDefinitionRepository = routeDefinitionRepository;
  }

  @Override
  public void run(String... args) throws Exception {
    routeDefinitionRepository.gatewayRouteInit();
  }

}
